Cover TOC Chap Prev Chap Prev Fig Next Fig Next Chap

Chapter 17: Mapping Textures

../ch17/17fig10c.gif
Figure 17.10c

A tree texture image texture mapped, with pixel transparencies, on a rectangular face to create a tree.

17fig10c.wrl
Click on the image to view the VRML scene.

#VRML V2.0 utf8
# The VRML 2.0 Sourcebook
# Copyright (c) 1997
# Andrea L. Ames, David R. Nadeau, and John L. Moreland
Group {
    children [
    # Ground
        Shape {
            appearance Appearance {
                material Material { }
            }
            geometry IndexedFaceSet {
                coord Coordinate {
                    point [
                        -5.0 0.0  5.0,  5.0 0.0  5.0,
                         5.0 0.0 -5.0, -5.0 0.0 -5.0,
                    ]
                }
                coordIndex [ 0, 1, 2, 3 ]
                solid FALSE
            }
        },
    # Tree face
        Shape {
            appearance Appearance {
                # No material, use emissive texturing
                texture ImageTexture {
                    url "tree1.png"
                }
            }
            geometry IndexedFaceSet {
                coord Coordinate {
                    point [
                        -1.51 0.0 0.0,   1.51 0.0 0.0,
                         1.51 3.0 0.0,  -1.51 3.0 0.0,
                    ]
                }
                coordIndex [ 0, 1, 2, 3 ]
                solid FALSE
            }
        }
    ]
}